Queries

A query is used to extract data from the database in a readable format according to the user's request. Navicat provides two powerful tools for working with the SQL queries: Query Editor for editing the query text directly and Query Builder for building queries visually. You can save your queries for setting schedule.

Just simply click to open an object pane for Query. A control-click displays the popup menu or using the object pane toolbar below, allowing you to create new, edit, open and delete the selected query.

Create Query

To create a new query in Query Editor

To create a new query in Query Builder

To create a new query with loading from a SQL file

Hint: To create a new query, you can also control-click the Queries node of the navigation pane and select the New Query from the popup menu.

To create a new query with the same properties as one of the existing queries has (using popup menu)

Apply to: current database {same connection}
  • Select the query(s) for copying in the navigation pane/object pane.
  • Control-click and select the Duplicate Query from the popup menu.
  • The newly created query(s) will be named as "queryname_copy".

To create a new query with the same properties as one of the existing queries has (using drag and drop method)

Apply to: current database {same connection}
  • Select the query(s) for copying in the navigation pane/object pane.
  • Drag and drag the chosen query(s) to the target location.
  • Select one of the following options:
    • Copy
    • Cancel
  • The newly created query(s) will be named as "queryname_copy"
Apply to: different database {same connection}
  different database {different connection}
  • Select the query(s) for copying in the navigation pane/object pane.
  • Drag and drop the chosen query(s) to the target location.
  • Select one of the following options:
    • Copy
    • Cancel
  • The newly created query(s) will share the same name as the dragged query.

To create a new query with modification as one of the existing queries

Hint: Queries(.sql) are saved under the Setting Save Path.

Edit Query

To edit the existing query

To change the name of the query

Open Query

To open a query (manage query data)

Note: Only SELECT queries will be run automatically with results being displayed on Result tab.

Run Query

To run a query

To run a saved query from the command line

Delete Query

To delete a query

Achieve Query Information

To achieve a query information